#pragma once
#include "ObjectProperty.h"
#include "gfxUtilities.h"

/*! 
 * A text properties for an UI object.
 */
class GfxText: public ObjectProperty
{
public:
	static const StringHash GFX_TEXT_ID;

	GfxText(const ObjectId& objectId, 
			const std::string& name,
			const std::string& fontName = "FixedSys", 
			const uint8 fontSize = 20,
			const std::string& text = "",
			const GfxColor& fontColor = GfxColor(255, 255, 255, 255),
			const GfxRectangle& destinationRectangle = GfxRectangle(0, 0, 0, 0),
			bool isActive = false);
	~GfxText();
	
	/*! 
	 * Return the name used to identify the font associated with this property.
	 */ 
	const std::string& getName() const;
	/*! 
	 * Return the font name.
	 */
	const std::string& getFontName() const;
	/*!
	 * Return the font size.
	 */
	const uint8& getFontSize() const;

	/*!
	 * Set the text to show.
	 */
	void setText(const std::string& text = "");
	/*! 
	 * Get the current text.
	 */
	const std::string& getText() const;

	/*! 
	 * Set a color for the current text.
	 */
	void setFontColor(const uint8 red, const uint8 green, const uint8 blue, const uint8 alpha = 255);
	/*! 
	 * Set a color for the current text.
	 */
	void setFontColor(const GfxColor& fontColor = GfxColor(255, 255, 255, 255));
	/*! 
	 * Get the current color.
	 */
	const GfxColor& getFontColor() const;

	/*!
	 * Set the output rectangle.
	 */
	void setTextRectangle(const GfxRectangle& rectangle);
	/*!
	 * Set the output rectangle.
	 */
	void setTextRectangle(uint32 x, uint32 y, uint32 width, uint32 height);
	/*!
	 * Get the current output rectangle.
	 */
	const GfxRectangle& getTextRectangle() const;

	/*!
	 * Set this text as active.
	 * 
	 * \note Only active objects are rendered by the graphicsComponent.
	 */
	void setActive(bool active);
	/*!
	 * Return the active state of the text.
	 */
	bool isActive() const;

private:
	std::string		m_name;

	std::string		m_fontName;
	uint8			m_fontSize;
	
	std::string		m_text;

	GfxColor		m_fontColor;
	GfxRectangle	m_destinationRectangle;

	bool			m_isActive;
};